Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download resources from osf #277

Merged
merged 7 commits into from
Feb 15, 2024
Merged

Download resources from osf #277

merged 7 commits into from
Feb 15, 2024

Conversation

akhanf
Copy link
Member

@akhanf akhanf commented Feb 15, 2024

Adds a download.smk rules file and a couple of rules to download+extract zip files from osf for templates and atlases. Will go in template and atlas subfolders in the hippunfold cache dir (ie HIPPUNFOLD_CACHE_DIR, or appdir's cache which defaults to the home directory).

The files are extracted using a snakemake output directory(), so the contents are not monitored by snakemake, only the folders. So for downstream rules the files have to be specified in params, using the folder (ie atlas_dir, template_dir) in the inputs. Only downside is a dry-run without files downloaded won't be able to check to see if the config['template_files'] or config['atlas_files'] entries are correct. But could just do hippunfold --until download_extract_atlas_or_template -c 1 to pre-download the relevant resources, then a dry-run after that would work..

Note: the folder structure of the HIPPUNFOLD_CACHE_DIR will change since models won't be in the top level. We could document this perhaps in the next release notes to indicate how to move them:

mkdir $HIPPUNFOLD_CACHE_DIR/model && mv -v $HIPPUNFOLD_CACHE_DIR/*.model_best.tar $HIPPUNFOLD_CACHE_DIR/model

TODO: use other urls too
- HIPPUNFOLD_CACHE_DIR now has model, atlas, and template subdirs
avoids breaking the seg* modalities
@akhanf akhanf mentioned this pull request Feb 15, 2024
@akhanf
Copy link
Member Author

akhanf commented Feb 15, 2024

Just realized I forgot the upenn template, will do that now

@akhanf
Copy link
Member Author

akhanf commented Feb 15, 2024

actually, I'll leave tpl-upenn there for now, as the shape-inject stuff gets edited with the template-based segmentation edits which will be in another PR..

@jordandekraker
Copy link
Collaborator

Very nice!

Perhaps this would be a good branch to scrub the large files (i.e. mostly resources) from our git history to reduce the size of clones?

@akhanf
Copy link
Member Author

akhanf commented Feb 15, 2024

I think that would be done at the git repository level since it would scrub things beyond this branch.. but I'll have a look now

@akhanf akhanf added the maintenance Updates or improvements that do not change functionality of the code label Feb 15, 2024
@akhanf akhanf merged commit f0d0d8e into master Feb 15, 2024
5 checks passed
@akhanf akhanf deleted the download-osf branch February 15, 2024 19:50
akhanf added a commit that referenced this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Updates or improvements that do not change functionality of the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants